Look: Uniformize code and array presentation
Doc: Doxygen
This commit is contained in:
parent
29f6a7d1be
commit
e00eb762f4
@ -21,7 +21,7 @@
|
||||
* \file htdocs/comm/index.php
|
||||
* \ingroup commercial
|
||||
* \brief Home page of commercial area
|
||||
* \version $Id: index.php,v 1.172 2011/08/08 12:22:52 eldy Exp $
|
||||
* \version $Id: index.php,v 1.173 2011/08/08 14:25:44 eldy Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@ -272,6 +272,87 @@ $NBMAX=3;
|
||||
$max=3;
|
||||
|
||||
|
||||
/*
|
||||
* Last modified proposals
|
||||
*/
|
||||
/*
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas, p.rowid as propalid, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
//$sql.= " AND p.fk_statut > 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY p.datep DESC";
|
||||
$sql.= $db->plimit($NBMAX, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("LastModifiedProposals",$NBMAX).'</td></tr>';
|
||||
$var=False;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td nowrap="nowrap" width="140">';
|
||||
|
||||
$propalstatic->id=$objp->propalid;
|
||||
$propalstatic->ref=$objp->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding" nowrap="nowrap">';
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
|
||||
// TODO se baser sur datep ou fin_validite ?
|
||||
if (($objp->fk_statut <= 1) && ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay))) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->propalid;
|
||||
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->name=$objp->name;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->canvas=$objp->canvas;
|
||||
print $companystatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print dol_print_date($db->jdate($objp->dp),'day').'</td>'."\n";
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>'."\n";
|
||||
print '<td align="center" width="14">'.$propalstatic->LibStatut($objp->fk_statut,3).'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$var=!$var;
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,'');
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Last modified customers or prospects
|
||||
*/
|
||||
@ -405,8 +486,7 @@ if ($user->rights->agenda->myactions->read)
|
||||
|
||||
|
||||
/*
|
||||
* Derniers contrats
|
||||
*
|
||||
* Last contracts
|
||||
*/
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
|
||||
{
|
||||
@ -465,8 +545,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire && 0) // TODO A REFA
|
||||
}
|
||||
|
||||
/*
|
||||
* Propales ouvertes
|
||||
*
|
||||
* Opened proposals
|
||||
*/
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
{
|
||||
@ -551,5 +630,5 @@ print '</table>';
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter('$Date: 2011/08/08 12:22:52 $ - $Revision: 1.172 $');
|
||||
llxFooter('$Date: 2011/08/08 14:25:44 $ - $Revision: 1.173 $');
|
||||
?>
|
||||
@ -21,7 +21,7 @@
|
||||
* \file htdocs/comm/propal/index.php
|
||||
* \ingroup propal
|
||||
* \brief Home page of proposal area
|
||||
* \version $Id: index.php,v 1.7 2011/08/03 00:46:34 eldy Exp $
|
||||
* \version $Id: index.php,v 1.8 2011/08/08 14:25:44 eldy Exp $
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
@ -47,7 +47,7 @@ if ($user->societe_id > 0)
|
||||
* View
|
||||
*/
|
||||
|
||||
$propal_static=new Propal($db);
|
||||
$propalstatic=new Propal($db);
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$help_url="EN:Module_Commercial_Proposals|FR:Module_Propositions_commerciales|ES:Módulo Presupuestos";
|
||||
@ -122,12 +122,12 @@ if ($resql)
|
||||
$listofstatus=array(0,1,2,3,4);
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$propal_static->LibStatut($status,1),'values'=>array(0=>(isset($vals[$status])?$vals[$status]:0)));
|
||||
$dataseries[]=array('label'=>$propalstatic->LibStatut($status,1),'values'=>array(0=>(isset($vals[$status])?$vals[$status]:0)));
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$propal_static->LibStatut($status,0).'</td>';
|
||||
print '<td>'.$propalstatic->LibStatut($status,0).'</td>';
|
||||
print '<td align="right"><a href="liste.php?statut='.$status.'">'.(isset($vals[$status])?$vals[$status]:0).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
@ -234,12 +234,12 @@ if ($resql)
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="20%" nowrap="nowrap">';
|
||||
|
||||
$propal_static->id=$obj->rowid;
|
||||
$propal_static->ref=$obj->ref;
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="96" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $propal_static->getNomUrl(1);
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding" nowrap="nowrap">';
|
||||
@ -257,7 +257,7 @@ if ($resql)
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
print '<td align="right">'.$propal_static->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -267,6 +267,85 @@ if ($resql)
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
/*
|
||||
* Opened proposals
|
||||
*/
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
{
|
||||
$langs->load("propal");
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY p.rowid DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal.php?viewstatut=1">('.$num.')</a></td></tr>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td nowrap="nowrap" width="140">';
|
||||
|
||||
$propalstatic->id=$obj->propalid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding" nowrap="nowrap">';
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
|
||||
if ($db->jdate($obj->dp) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
|
||||
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>";
|
||||
|
||||
print '<td align="left"><a href="fiche.php?socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,44).'</a></td>'."\n";
|
||||
print '<td align="right">';
|
||||
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($total>0) {
|
||||
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Proposals to process
|
||||
*/
|
||||
@ -304,12 +383,12 @@ if ($conf->propal->enabled)
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
$propal_static->id=$obj->rowid;
|
||||
$propal_static->ref=$obj->ref;
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="96" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $propal_static->getNomUrl(1);
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding" nowrap="nowrap">';
|
||||
@ -327,7 +406,7 @@ if ($conf->propal->enabled)
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td>';
|
||||
|
||||
print '<td align="right">'.$propal_static->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
|
||||
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
@ -376,12 +455,12 @@ if ($conf->propal->enabled)
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="20%" nowrap="nowrap">';
|
||||
|
||||
$propal_static->id=$obj->rowid;
|
||||
$propal_static->ref=$obj->ref;
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="96" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $propal_static->getNomUrl(1);
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding" nowrap="nowrap">';
|
||||
@ -399,7 +478,7 @@ if ($conf->propal->enabled)
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
||||
|
||||
print '<td align="right">'.$propal_static->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
|
||||
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
@ -415,6 +494,6 @@ print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/03 00:46:34 $ - $Revision: 1.7 $');
|
||||
llxFooter('$Date: 2011/08/08 14:25:44 $ - $Revision: 1.8 $');
|
||||
|
||||
?>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
* \file htdocs/compta/index.php
|
||||
* \ingroup compta
|
||||
* \brief Main page of accountancy area
|
||||
* \version $Id: index.php,v 1.184 2011/08/03 00:46:24 eldy Exp $
|
||||
* \version $Id: index.php,v 1.185 2011/08/08 14:25:45 eldy Exp $
|
||||
*/
|
||||
|
||||
require('../main.inc.php');
|
||||
@ -347,7 +347,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BoxTitleLastCustomerBills",min($max,$num)).'</td>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BoxTitleLastCustomerBills",$max).'</td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
@ -444,7 +444,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BoxTitleLastSupplierBills",min($max,$num)).'</td>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BoxTitleLastSupplierBills",$max).'</td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
@ -519,7 +519,7 @@ if ($conf->don->enabled && $user->rights->societe->lire)
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("BoxTitleLastModifiedDonations",min($max,$num)).'</td>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("BoxTitleLastModifiedDonations",$max).'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
@ -588,7 +588,7 @@ if ($conf->deplacement->enabled && $user->rights->deplacement->lire)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",$max).'</td>';
|
||||
print '<td align="right">'.$langs->trans("FeesKilometersOrAmout").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
@ -838,7 +838,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpaid",min($conf->liste_limit,$num)).' <a href="'.DOL_URL_ROOT.'/compta/facture/impayees.php">('.$num.')</a></td>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/compta/facture/impayees.php">('.$num.')</a></td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Received").'</td>';
|
||||
@ -943,7 +943,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsSuppliersUnpaid",min($conf->liste_limit,$num)).' <a href="'.DOL_URL_ROOT.'/fourn/facture/impayees.php">('.$num.')</a></td>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsSuppliersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/fourn/facture/impayees.php">('.$num.')</a></td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Paid").'</td>';
|
||||
@ -1031,5 +1031,5 @@ print '</table>';
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter('$Date: 2011/08/03 00:46:24 $ - $Revision: 1.184 $');
|
||||
llxFooter('$Date: 2011/08/08 14:25:45 $ - $Revision: 1.185 $');
|
||||
?>
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
* \file htdocs/contrat/class/contrat.class.php
|
||||
* \ingroup contrat
|
||||
* \brief Fichier de la classe des contrats
|
||||
* \version $Id: contrat.class.php,v 1.23 2011/07/31 23:50:01 eldy Exp $
|
||||
* \version $Id: contrat.class.php,v 1.24 2011/08/08 14:25:44 eldy Exp $
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
@ -1542,8 +1542,8 @@ class ContratLigne
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur d'objets ligne de contrat
|
||||
* \param DB Database access handler
|
||||
* Constructeur d'objets ligne de contrat
|
||||
* @param DB Database access handler
|
||||
*/
|
||||
function ContratLigne($DB)
|
||||
{
|
||||
@ -1552,9 +1552,9 @@ class ContratLigne
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return label of this contract line status
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \return string Libelle
|
||||
* Return label of this contract line status
|
||||
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
{
|
||||
@ -1562,11 +1562,11 @@ class ContratLigne
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return label of a contract line status
|
||||
* \param statut id statut
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \param expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||
* \return string Libelle
|
||||
* Return label of a contract line status
|
||||
* @param statut id statut
|
||||
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||
* @return string Libelle
|
||||
*/
|
||||
function LibStatut($statut,$mode,$expired=-1)
|
||||
{
|
||||
@ -1623,10 +1623,10 @@ class ContratLigne
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
\param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
\return string Chaine avec URL
|
||||
*/
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlength=0)
|
||||
{
|
||||
global $langs;
|
||||
@ -1647,10 +1647,10 @@ class ContratLigne
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Load object in memory from database
|
||||
* \param id id object
|
||||
* \param ref Ref of contract
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* Load object in memory from database
|
||||
* @param id id object
|
||||
* @param ref Ref of contract
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
@ -1752,11 +1752,11 @@ class ContratLigne
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Update database for contract line
|
||||
* \param user User that modify
|
||||
* \param notrigger 0=no, 1=yes (no update trigger)
|
||||
* \return int <0 if KO, >0 if OK
|
||||
/**
|
||||
* Update database for contract line
|
||||
* @param user User that modify
|
||||
* @param notrigger 0=no, 1=yes (no update trigger)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user, $notrigger=0)
|
||||
{
|
||||
@ -1854,9 +1854,9 @@ class ContratLigne
|
||||
|
||||
|
||||
/**
|
||||
* \brief Mise a jour en base des champs total_xxx de ligne
|
||||
* \remarks Utilise par migration
|
||||
* \return int <0 si ko, >0 si ok
|
||||
* Mise a jour en base des champs total_xxx de ligne
|
||||
* Used by migration process
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update_total()
|
||||
{
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
/**
|
||||
* \file htdocs/contrat/index.php
|
||||
* \ingroup contrat
|
||||
* \brief Page liste des contrats
|
||||
* \version $Revision: 1.84 $
|
||||
* \brief Home page of contract area
|
||||
* \version $Revision: 1.85 $
|
||||
*/
|
||||
|
||||
require ("../main.inc.php");
|
||||
@ -45,6 +45,14 @@ $result = restrictedArea($user, 'contrat',$contratid,'');
|
||||
$staticcompany=new Societe($db);
|
||||
$staticcontrat=new Contrat($db);
|
||||
$staticcontratligne=new ContratLigne($db);
|
||||
$productstatic=new Product($db);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
/*
|
||||
@ -355,13 +363,94 @@ else
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Not activated services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.description as note, cd.fk_contrat, s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
// Last modified services
|
||||
$sql = "SELECT c.ref, c.fk_soc, ";
|
||||
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
|
||||
$sql.= " s.nom,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE cd.fk_contrat = c.rowid";
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastModifiedServices",$max).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$max))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td width="100" nowrap="nowrap">';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat);
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
$productstatic->id=$obj->fk_product;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note,20);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
$dateend=$db->jdate($obj->date_fin_validite);
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Not activated services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
|
||||
$sql.= " s.nom,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE c.statut=1";
|
||||
$sql.= " AND cd.statut = 0";
|
||||
$sql.= " AND cd.fk_contrat = c.rowid";
|
||||
@ -379,7 +468,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("NotActivatedServices").'</td>';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=0">('.$num.')</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
@ -394,10 +483,21 @@ if ($resql)
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dol_trunc($obj->note,20).'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
$productstatic->id=$obj->fk_product;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note,20);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
@ -421,17 +521,19 @@ else
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Last modified services
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT c.ref, c.fk_soc, ";
|
||||
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
|
||||
$sql.= " s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
// Expired services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
|
||||
$sql.= " s.nom,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cd.fk_contrat = c.rowid";
|
||||
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE c.statut=1";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
$sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
$sql.= " AND cd.fk_contrat = c.rowid";
|
||||
$sql.= " AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -446,32 +548,43 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastModifiedServices",min($num,$max)).'</td>';
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=4&filter=expired">('.$num.')</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$max))
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td width="100" nowrap="nowrap">';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat);
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dol_trunc($obj->note,20).'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
$productstatic->id=$obj->fk_product;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note,20);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
$dateend=$db->jdate($obj->date_fin_validite);
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0);
|
||||
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,3,1);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -492,5 +605,5 @@ print '<br>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 23:46:55 $ - $Revision: 1.84 $');
|
||||
llxFooter('$Date: 2011/08/08 14:25:44 $ - $Revision: 1.85 $');
|
||||
?>
|
||||
@ -21,7 +21,7 @@
|
||||
* \file htdocs/contrat/services.php
|
||||
* \ingroup contrat
|
||||
* \brief Page to list services in contracts
|
||||
* \version $Id: services.php,v 1.57 2011/07/31 23:46:55 eldy Exp $
|
||||
* \version $Id: services.php,v 1.58 2011/08/08 14:25:44 eldy Exp $
|
||||
*/
|
||||
|
||||
require ("../main.inc.php");
|
||||
@ -93,7 +93,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc
|
||||
if ($mode == "0") $sql.= " AND cd.statut = 0";
|
||||
if ($mode == "4") $sql.= " AND cd.statut = 4";
|
||||
if ($mode == "5") $sql.= " AND cd.statut = 5";
|
||||
if ($filter == "expired") $sql.= " AND date_fin_validite < ".$db->idate($now);
|
||||
if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
if ($search_nom) $sql.= " AND s.nom like '%".$db->escape($search_nom)."%'";
|
||||
if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
|
||||
if ($search_service) $sql.= " AND (p.ref like '%".$db->escape($search_service)."%' OR p.description like '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
@ -266,5 +266,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 23:46:55 $ - $Revision: 1.57 $');
|
||||
llxFooter('$Date: 2011/08/08 14:25:44 $ - $Revision: 1.58 $');
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user