New: Le statut d'un contrat est maintenant reprsent par les statut de ces lignes.
This commit is contained in:
parent
26af0cb262
commit
7430dc5bb3
@ -46,7 +46,7 @@ class Contrat extends CommonObject
|
||||
var $ref;
|
||||
var $socid;
|
||||
var $societe; // Objet societe
|
||||
|
||||
var $statut=0; // 0=Draft,
|
||||
var $product;
|
||||
|
||||
var $user_author;
|
||||
@ -66,8 +66,8 @@ class Contrat extends CommonObject
|
||||
|
||||
var $fk_projet;
|
||||
|
||||
var $statuts=array();
|
||||
|
||||
var $lignes=array();
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
@ -82,11 +82,6 @@ class Contrat extends CommonObject
|
||||
$this->societe = new Societe($DB);
|
||||
$this->user_service = new User($DB);
|
||||
$this->user_cloture = new User($DB);
|
||||
|
||||
// Statut 0=ouvert, 1=actif, 2=clotur<75>
|
||||
$this->statuts[0]=$langs->trans("Draft");
|
||||
$this->statuts[1]=$langs->trans("Validated");
|
||||
$this->statuts[2]=$langs->trans("Closed");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -344,9 +339,11 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
function fetch_lignes()
|
||||
{
|
||||
$this->lignes = array();
|
||||
|
||||
// Selectionne les lignes contrats li<6C>es <20> un produit
|
||||
$this->nbofserviceswait=0;
|
||||
$this->nbofservicesopened=0;
|
||||
$this->nbofservicesclosed=0;
|
||||
|
||||
// Selectionne les lignes contrats liees a un produit
|
||||
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
|
||||
$sql.= " d.rowid, d.statut, d.description, d.price_ht, d.tva_tx, d.qty, d.remise_percent, d.subprice,";
|
||||
$sql.= " d.info_bits, d.fk_product,";
|
||||
@ -391,6 +388,11 @@ class Contrat extends CommonObject
|
||||
$this->lignes[] = $ligne;
|
||||
//dolibarr_syslog("1 ".$ligne->desc);
|
||||
//dolibarr_syslog("2 ".$ligne->product_desc);
|
||||
|
||||
if ($ligne->statut == 0) $this->nbofserviceswait++;
|
||||
if ($ligne->statut == 4) $this->nbofservicesopened++;
|
||||
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
@ -401,7 +403,7 @@ class Contrat extends CommonObject
|
||||
return -3;
|
||||
}
|
||||
|
||||
// Selectionne les lignes contrat li<EFBFBD>es <20> aucun produit
|
||||
// Selectionne les lignes contrat liees a aucun produit
|
||||
$sql = "SELECT d.rowid, d.statut, d.qty, d.description, d.price_ht, d.subprice, d.tva_tx, d.rowid, d.remise_percent,";
|
||||
$sql.= " d.date_ouverture_prevue, d.date_ouverture,";
|
||||
$sql.= " d.date_fin_validite, d.date_cloture";
|
||||
@ -413,9 +415,9 @@ class Contrat extends CommonObject
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
$i = 0;
|
||||
|
||||
while ($j < $num)
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$ligne = new ContratLigne($this->db);
|
||||
@ -436,9 +438,12 @@ class Contrat extends CommonObject
|
||||
$ligne->date_fin_prevue = $objp->date_fin_validite;
|
||||
$ligne->date_fin_reel = $objp->date_cloture;
|
||||
|
||||
if ($ligne->statut == 0) $this->nbofserviceswait++;
|
||||
if ($ligne->statut == 4) $this->nbofservicesopened++;
|
||||
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
||||
|
||||
$this->lignes[] = $ligne;
|
||||
$i++;
|
||||
$j++;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
@ -450,19 +455,21 @@ class Contrat extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
|
||||
$this->nbofservices=sizeof($this->lignes);
|
||||
|
||||
return $this->lignes;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Cr<EFBFBD>e un contrat vierge en base
|
||||
* \param user Utilisateur qui cr<EFBFBD>e
|
||||
* \brief Cree un contrat vierge en base
|
||||
* \param user Utilisateur qui cree
|
||||
* \param langs Environnement langue de l'utilisateur
|
||||
* \param conf Environnement de configuration lors de l'op<EFBFBD>ration
|
||||
* \return int <0 si erreur, id contrat cr<EFBFBD><EFBFBD> sinon
|
||||
* \param conf Environnement de configuration lors de l'operation
|
||||
* \return int <0 si erreur, id contrat cre sinon
|
||||
*/
|
||||
function create($user,$langs='',$conf='')
|
||||
{
|
||||
// Controle validit<69> des param<61>tres
|
||||
// Check parameters
|
||||
$paramsok=1;
|
||||
if ($this->commercial_signature_id <= 0)
|
||||
{
|
||||
@ -481,14 +488,14 @@ class Contrat extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Ins<EFBFBD>re contrat
|
||||
// Insert contract
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat";
|
||||
// $sql.= ", fk_commercial_signature, fk_commercial_suivi";
|
||||
$sql.= ", fk_commercial_signature, fk_commercial_suivi";
|
||||
$sql.= " , ref)";
|
||||
$sql.= " VALUES (now(),".$this->socid.",".$user->id;
|
||||
$sql.= ",".$this->db->idate($this->date_contrat);
|
||||
// $sql.= ",".($this->commercial_signature_id>=0?$this->commercial_signature_id:"null");
|
||||
// $sql.= ",".($this->commercial_suivi_id>=0?$this->commercial_suivi_id:"null");
|
||||
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
|
||||
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
|
||||
$sql .= ", " . (strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
|
||||
$sql.= ")";
|
||||
$resql=$this->db->query($sql);
|
||||
@ -737,7 +744,7 @@ class Contrat extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result=$this->update_price();
|
||||
$result=$this->update_statut();
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -766,17 +773,17 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mets <EFBFBD> jour une ligne de contrat
|
||||
* \brief Mets a jour une ligne de contrat
|
||||
* \param rowid Id de la ligne de facture
|
||||
* \param desc Description de la ligne
|
||||
* \param pu Prix unitaire
|
||||
* \param qty Quantit<EFBFBD>
|
||||
* \param qty Quantite
|
||||
* \param remise_percent Pourcentage de remise de la ligne
|
||||
* \param date_start Date de debut pr<EFBFBD>vue
|
||||
* \param date_end Date de fin pr<EFBFBD>vue
|
||||
* \param date_start Date de debut prevue
|
||||
* \param date_end Date de fin prevue
|
||||
* \param tvatx Taux TVA
|
||||
* \param date_debut_reel Date de debut r<EFBFBD>elle
|
||||
* \param date_fin_reel Date de fin r<EFBFBD>elle
|
||||
* \param date_debut_reel Date de debut reelle
|
||||
* \param date_fin_reel Date de fin reelle
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0,
|
||||
@ -827,7 +834,7 @@ class Contrat extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$result=$this->update_price();
|
||||
$result=$this->update_statut();
|
||||
if ($result >= 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -891,19 +898,30 @@ class Contrat extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Mets a jour le prix total du contrat
|
||||
* \brief Update statut of contract according to services
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update_price()
|
||||
function update_statut()
|
||||
{
|
||||
// Function empty because there is no total in contract parent table
|
||||
// If draft, we keep it (should not happen)
|
||||
if ($this->statut == 0) return 1;
|
||||
|
||||
// Load $this->lignes array
|
||||
// $this->fetch_lignes();
|
||||
|
||||
$newstatut=1;
|
||||
foreach($this->lignes as $key => $contractline)
|
||||
{
|
||||
// if ($contractline) // Loop on each service
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libell<EFBFBD> du statut du contrat
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \brief Retourne le libelle du statut du contrat
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
@ -912,10 +930,10 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
||||
* \brief Renvoi le libelle d'un statut donne
|
||||
* \param statut id statut
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
* \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 LibStatut($statut,$mode)
|
||||
{
|
||||
@ -923,9 +941,9 @@ class Contrat extends CommonObject
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
|
||||
if ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
|
||||
if ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
|
||||
if ($statut == 0) { return $langs->trans("ContractStatusDraft").$text; }
|
||||
if ($statut == 1) { return $langs->trans("ContractStatusValidated").$text; }
|
||||
if ($statut == 2) { return $langs->trans("ContractStatusClosed").$text; }
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
@ -947,7 +965,16 @@ class Contrat extends CommonObject
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); }
|
||||
$line=new ContratLigne($this->db);
|
||||
$text=($this->nbofserviceswait+$this->nbofservicesopened+$this->nbofservicesclosed);
|
||||
$text.=' '.$langs->trans("Services");
|
||||
$text.=': ';
|
||||
$text.=$this->nbofserviceswait.' '.$line->LibStatut(0,3).' ';
|
||||
$text.=$this->nbofservicesopened.' '.$line->LibStatut(4,3).' ';
|
||||
$text.=$this->nbofservicesclosed.' '.$line->LibStatut(5,3);
|
||||
return $text;
|
||||
|
||||
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); }
|
||||
if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); }
|
||||
if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); }
|
||||
}
|
||||
@ -960,7 +987,34 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
\brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
\param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
\param option Sur quoi pointe le lien
|
||||
\return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
$picto='bill';
|
||||
if ($this->type == 1) $picto.='r';
|
||||
if ($this->type == 2) $picto.='a';
|
||||
|
||||
$label=$langs->trans("ShowContract").': '.$this->ref;
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Charge les informations d'ordre info dans l'objet contrat
|
||||
* \param id id du contrat a charger
|
||||
*/
|
||||
@ -1138,7 +1192,7 @@ class ContratLigne
|
||||
var $tms;
|
||||
var $fk_contrat;
|
||||
var $fk_product;
|
||||
var $statut; // 4 active, 5 closed
|
||||
var $statut; // 0 inactive, 4 active, 5 closed
|
||||
var $label;
|
||||
var $description;
|
||||
var $date_commande;
|
||||
@ -1173,15 +1227,10 @@ class ContratLigne
|
||||
}
|
||||
|
||||
|
||||
function is_activated()
|
||||
{
|
||||
return $this->statut == 4 ;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le libell<EFBFBD> du statut du contrat
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
* \brief Retourne le libelle du statut de la ligne de contrat
|
||||
* \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)
|
||||
{
|
||||
@ -1189,10 +1238,10 @@ class ContratLigne
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libell<EFBFBD> d'un statut donn<EFBFBD>
|
||||
* \brief Renvoi le libelle d'un statut donne
|
||||
* \param statut id statut
|
||||
* \param mode 0=libell<EFBFBD> long, 1=libell<EFBFBD> court, 2=Picto + Libell<EFBFBD> court, 3=Picto, 4=Picto + Libell<EFBFBD> long, 5=Libell<EFBFBD> court + Picto
|
||||
* \return string Libell<EFBFBD>
|
||||
* \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 LibStatut($statut,$mode)
|
||||
{
|
||||
@ -1331,12 +1380,12 @@ class ContratLigne
|
||||
|
||||
|
||||
/*
|
||||
* \brief Update database
|
||||
* \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
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
function update($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -1388,16 +1437,22 @@ class ContratLigne
|
||||
$sql.= " total_tva='".$this->total_tva."',";
|
||||
$sql.= " total_ttc='".$this->total_ttc."',";
|
||||
$sql.= " info_bits='".$this->info_bits."',";
|
||||
$sql.= " fk_user_author='".$this->fk_user_author."',";
|
||||
$sql.= " fk_user_ouverture='".$this->fk_user_ouverture."',";
|
||||
$sql.= " fk_user_cloture='".$this->fk_user_cloture."',";
|
||||
$sql.= " fk_user_author=".($this->fk_user_author >= 0?$this->fk_user_author:"NULL").",";
|
||||
$sql.= " fk_user_ouverture=".($this->fk_user_ouverture > 0?$this->fk_user_ouverture:"NULL").",";
|
||||
$sql.= " fk_user_cloture=".($this->fk_user_cloture > 0?$this->fk_user_cloture:"NULL").",";
|
||||
$sql.= " commentaire='".addslashes($this->commentaire)."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dolibarr_syslog("Contratdet::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
if ($resql)
|
||||
{
|
||||
$contrat=new Contrat($this->db);
|
||||
$contrat->fetch($this->fk_contrat);
|
||||
$result=$contrat->update_statut();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dolibarr_syslog("Contratdet::update ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
|
||||
@ -589,6 +589,8 @@ else
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$nbofservices=sizeof($contrat->lignes);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $contrat->user_author_id;
|
||||
$author->fetch();
|
||||
@ -669,7 +671,8 @@ else
|
||||
|
||||
// Statut contrat
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
|
||||
print $contrat->getLibStatut(2);
|
||||
if ($contrat->statut==0) print $contrat->getLibStatut(2);
|
||||
else print $contrat->getLibStatut(4);
|
||||
print "</td></tr>";
|
||||
|
||||
// Date
|
||||
@ -708,7 +711,6 @@ else
|
||||
echo '<br>';
|
||||
|
||||
$servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1);
|
||||
$nbofservices=sizeof($contrat->lignes);
|
||||
$colorb='333333';
|
||||
|
||||
/*
|
||||
@ -1202,12 +1204,18 @@ else
|
||||
else print '<a class="butAction" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
|
||||
$numclos=$contrat->array_detail(5); // Tableau des lignes au statut clos
|
||||
if ($contrat->statut == 1 && $nbofservices == sizeof($numclos))
|
||||
if ($contrat->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$id.'&action=close">'.$langs->trans("Close").'</a>';
|
||||
//if (! $numactive)
|
||||
//{
|
||||
print '<a class="butAction" href="fiche.php?id='.$id.'&action=close">'.$langs->trans("CloseAllContracts").'</a>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// print '<a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a>';
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
// On peut supprimer entite si
|
||||
// - Droit de creer + mode brouillon (erreur creation)
|
||||
// - Droit de supprimer
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -87,6 +87,73 @@ print $staticcontratligne->LibStatut(5,4).'<br />';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
/**
|
||||
* Draft contratcs
|
||||
*/
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire)
|
||||
{
|
||||
$sql = "SELECT c.rowid as ref, c.rowid,";
|
||||
$sql.= " s.nom, s.rowid as socid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE s.rowid = c.fk_soc AND c.statut = 0";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = ".$socid;
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
$var = false;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("DraftContracts").($num?' ('.$num.')':'').'</td></tr>';
|
||||
if ($num)
|
||||
{
|
||||
$companystatic=new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
$tot_ttc = 0;
|
||||
while ($i < $num && $i < 20)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'><td nowrap>';
|
||||
$staticcontrat->ref=$obj->ref;
|
||||
$staticcontrat->id=$obj->rowid;
|
||||
print $staticcontrat->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->nom=$obj->nom;
|
||||
$companystatic->client=1;
|
||||
print $companystatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->total_ttc;
|
||||
$i++;
|
||||
$var=!$var;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoContracts").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleftnoright">';
|
||||
|
||||
@ -104,12 +171,12 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid AND c.statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
$sql.= " GROUP BY c.rowid, c.datec, c.statut, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY c.datec DESC";
|
||||
$sql.= " LIMIT $max";
|
||||
$sql.= " ORDER BY c.tms DESC";
|
||||
$sql.= " LIMIT ".$max;
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
@ -121,7 +188,7 @@ if ($result)
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastContracts",5).'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Status").'</td>';
|
||||
//print '<td align="left">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="80" colspan="3">'.$langs->trans("Services").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -139,7 +206,7 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td><a href="../comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
||||
print '<td align="center">'.dolibarr_print_date($obj->datec).'</td>';
|
||||
print '<td align="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
//print '<td align="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td align="center">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_running+$obj->nb_late>0 ? ($obj->nb_running+$obj->nb_late).$staticcontratligne->LibStatut(4,3):'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5,3):'').'</td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -67,7 +67,7 @@ $sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
|
||||
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > sysdate()",1,0).') as nb_running,';
|
||||
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= sysdate())",1,0).') as nb_late,';
|
||||
$sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
|
||||
$sql.= " c.rowid as cid, c.ref, c.datec, c.statut, s.nom, s.rowid as socid";
|
||||
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, s.nom, s.rowid as socid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
@ -98,8 +98,9 @@ if ($resql)
|
||||
$param.='&search_nom='.$search_nom;
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'width="50"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.statut","","$param",'align="center"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.statut","","$param",'align="center"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(0,3).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(4,3).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(5,3).'</td>';
|
||||
@ -114,7 +115,7 @@ if ($resql)
|
||||
print '<input type="text" class="flat" size="24" name="search_nom" value="'.$search_nom.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
print '<td colspan="3" class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
@ -132,8 +133,9 @@ if ($resql)
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="../comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
||||
print '<td align="center">'.dolibarr_print_date($obj->datec).'</td>';
|
||||
print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>';
|
||||
//print '<td align="center">'.dolibarr_print_date($obj->datec).'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($obj->date_contrat).'</td>';
|
||||
//print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>';
|
||||
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_running+$obj->nb_late>0?$obj->nb_running+$obj->nb_late:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_closed>0?$obj->nb_closed:'').'</td>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Dolibarr language file - en_US - contracts
|
||||
ContractsArea=Contracts area
|
||||
ListOfContracts=List of contracts
|
||||
LastContracts=Last %s contracts
|
||||
LastContracts=Last %s modified contracts
|
||||
AllContracts=All contracts
|
||||
ContractCard=Contract card
|
||||
ContractStatus=Contract status
|
||||
@ -30,11 +30,12 @@ DeleteAContract=Delete a contract
|
||||
CloseAContract=Close a contract
|
||||
ConfirmDeleteAContract=Are you sure you want to delete this contract and all its services ?
|
||||
ConfirmValidateContract=Are you sure you want to validate this contract ?
|
||||
ConfirmCloseContract=Are you sure you want to close this contract ?
|
||||
ConfirmCloseContract=This will close all services (active or not). Are you sure you want to close this contract ?
|
||||
ConfirmCloseService=Are you sure you want to close this service with date <b>%s</b> ?
|
||||
ValidateAContract=Validate a contract
|
||||
ActivateService=Activate service
|
||||
ConfirmActivateService=Are you sure you want to activate this service with date of <b>%s</b> ?
|
||||
DateContract=Contract date
|
||||
DateServiceActivate=Date of service activation
|
||||
DateServiceUnactivate=Date of service unactivation
|
||||
DateServiceStart=Date for beginning of service
|
||||
@ -65,6 +66,9 @@ ServicesNomberShort=%s service(s)
|
||||
RunningServices=Running services
|
||||
BoardRunningServices=Expired running services
|
||||
ServiceStatus=Status of service
|
||||
DraftContracts=Drafts contracts
|
||||
CloseRefusedBecauseOneServiceActive=Contract can't be closed as ther is at least one open service on it
|
||||
CloseAllContracts=Close all contracts
|
||||
##### Types de contacts #####
|
||||
TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract
|
||||
TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up contract
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Dolibarr language file - fr_FR - contracts
|
||||
ContractsArea=Espace contrats
|
||||
ListOfContracts=Liste des contrats
|
||||
LastContracts=Les %s derniers contrats
|
||||
LastContracts=Les %s derniers contrats modifiés
|
||||
AllContracts=Tous les contrats
|
||||
ContractCard=Fiche contrat
|
||||
ContractStatus=État du contrat
|
||||
@ -30,11 +30,12 @@ DeleteAContract=Supprimer un contract
|
||||
CloseAContract=Cloturer un contract
|
||||
ConfirmDeleteAContract=Etes-vous sûr de vouloir supprimer ce contrat et tous ses services ?
|
||||
ConfirmValidateContract=Etes-vous sûr de vouloir valider ce contrat ?
|
||||
ConfirmCloseContract=Etes-vous sûr de vouloir cloturer ce contrat ?
|
||||
ConfirmCloseContract=Ceci fermera tous les services actifs et inactifs. Etes-vous sûr de vouloir cloturer ce contrat ?
|
||||
ConfirmCloseService=Etes-vous sûr de vouloir fermer ce service à la date du <b>%s</b> ?
|
||||
ValidateAContract=Valider un contrat
|
||||
ActivateService=Activer le service
|
||||
ConfirmActivateService=Etes-vous sûr de vouloir activer ce service en date du <b>%s</b> ?
|
||||
DateContract=Date contrat
|
||||
DateServiceActivate=Date activation du service
|
||||
DateServiceUnactivate=Date désactivation du service
|
||||
DateServiceStart=Date début du service
|
||||
@ -65,6 +66,9 @@ ServicesNomberShort=%s service(s)
|
||||
RunningServices=Services actifs
|
||||
BoardRunningServices=Services actifs expirés
|
||||
ServiceStatus=Statut du service
|
||||
DraftContracts=Contrats brouillons
|
||||
CloseRefusedBecauseOneServiceActive=Fermeture du contrat impossible car il y a au moins un service actif
|
||||
CloseAllContracts=Tout clôturer
|
||||
##### Types de contacts #####
|
||||
TypeContact_contrat_internal_SALESREPSIGN=Commercial signataire du contrat
|
||||
TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat
|
||||
|
||||
Loading…
Reference in New Issue
Block a user