Fix: Support option mysql strict for orders creation
New: Add a tab referers in project card. Qual: Mutualize all code for project referers view
This commit is contained in:
parent
2b4743c682
commit
5e4f47a8d7
@ -1850,7 +1850,7 @@ else
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="../compta/facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber.'</a></td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->df).'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->df,'day').'</td>';
|
||||
print '<td align="right">'.$objp->total_ttc.'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -1894,7 +1894,7 @@ else
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
|
||||
print '<td>'.dolibarr_print_date($objp->da)."</td>\n";
|
||||
print '<td>'.dolibarr_print_date($objp->da,'day')."</td>\n";
|
||||
print '<td>'.stripslashes($objp->label).'</td>';
|
||||
$authoract = new User($db);
|
||||
$authoract->id = $objp->fk_user_author;
|
||||
|
||||
@ -398,27 +398,31 @@ if ($action=='remove_file')
|
||||
*/
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->fetch($_GET["socid"]);
|
||||
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->fetch($_GET["socid"]);
|
||||
$commande->modelpdf = 'muscadet'; //test
|
||||
|
||||
if ($fourn->create_commande($user) > 0)
|
||||
{
|
||||
$idc = $fourn->single_open_commande;
|
||||
|
||||
if ($comclientid != '')
|
||||
$db->begin();
|
||||
|
||||
$orderid=$fourn->create_commande($user);
|
||||
if ($orderid > 0)
|
||||
{
|
||||
$fourn->updateFromCommandeClient($user,$idc,$comclientid);
|
||||
}
|
||||
$idc = $fourn->single_open_commande;
|
||||
|
||||
Header("Location:fiche.php?id=".$idc);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$fourn->error;
|
||||
}
|
||||
if ($comclientid != '')
|
||||
{
|
||||
$fourn->updateFromCommandeClient($user,$idc,$comclientid);
|
||||
|
||||
}
|
||||
|
||||
$_GET['id']=$orderid;
|
||||
$_GET['action']='edit';
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$mesg=$fourn->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ require_once('./pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/fourn/facture/paiementfourn.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
|
||||
|
||||
|
||||
if (!$user->rights->fournisseur->facture->lire)
|
||||
@ -298,7 +299,12 @@ if ($_GET['action'] == 'add_ligne')
|
||||
$_GET['action'] = '';
|
||||
}
|
||||
|
||||
|
||||
if ($_POST['action'] == 'classin')
|
||||
{
|
||||
$facture = new FactureFournisseur($db,'',$_GET['facid']);
|
||||
$facture->fetch($_GET['facid']);
|
||||
$facture->setProject($_POST['projetid']);
|
||||
}
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
@ -602,6 +608,37 @@ else
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($fac->total_tva).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($fac->total_ttc).'</td><td colspan="2" align="left">'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
|
||||
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'classer')
|
||||
{
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classer&facid='.$fac->id.'">';
|
||||
print img_edit($langs->trans('SetProject'),1);
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'classer')
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'projetid');
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</td><td valign="top" class="notopnoleftnoright">';
|
||||
|
||||
@ -75,7 +75,7 @@ class CommandeFournisseur extends Commande
|
||||
function fetch($id)
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
|
||||
$sql .= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql .= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql .= " c.note, c.note_public, c.model_pdf,";
|
||||
$sql .= " cm.libelle as methode_commande";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
@ -104,7 +104,8 @@ class CommandeFournisseur extends Commande
|
||||
|
||||
$this->source = $obj->source;
|
||||
$this->facturee = $obj->facture;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->projet_id = $obj->fk_project; // For compatibility with old code
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
@ -600,64 +601,64 @@ class CommandeFournisseur extends Commande
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Créé la commande au statut brouillon
|
||||
* \param user Utilisateur qui crée
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::Create soc id=".$this->socid);
|
||||
/**
|
||||
* \brief Créé la commande au statut brouillon
|
||||
* \param user Utilisateur qui crée
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::Create soc id=".$this->socid);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
/* On positionne en mode brouillon la commande */
|
||||
$this->brouillon = 1;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (fk_soc, date_creation, fk_user_author, fk_statut) ";
|
||||
$sql .= " VALUES (".$this->socid.", now(), ".$user->id.",0)";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur");
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||
$sql.= " SET ref='(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// On logue creation pour historique
|
||||
$this->log($user, 0, time());
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
$this->db->begin();
|
||||
|
||||
/* On positionne en mode brouillon la commande */
|
||||
$this->brouillon = 1;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (ref, fk_soc, date_creation, fk_user_author, fk_statut, source) ";
|
||||
$sql .= " VALUES ('',".$this->socid.", now(), ".$user->id.",0,0)";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur");
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||
$sql.= " SET ref='(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// On logue creation pour historique
|
||||
$this->log($user, 0, time());
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
dolibarr_syslog("CommandeFournisseur::Create : Success");
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - ".$sql;
|
||||
dolibarr_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - ".$sql;
|
||||
dolibarr_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
dolibarr_syslog("CommandeFournisseur::Create : Success");
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - ".$sql;
|
||||
dolibarr_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - ".$sql;
|
||||
dolibarr_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ajoute une ligne de commande
|
||||
|
||||
@ -176,7 +176,7 @@ class FactureFournisseur extends Facture
|
||||
{
|
||||
$sql = 'SELECT libelle, facnumber, amount, remise, '.$this->db->pdate(datef).'as df,';
|
||||
$sql.= ' total_ht, total_tva, total_ttc, fk_user_author,';
|
||||
$sql.= ' fk_statut, paye, f.note, f.note_public,';
|
||||
$sql.= ' fk_statut, fk_projet as fk_project, paye, f.note, f.note_public,';
|
||||
$sql.= ' '.$this->db->pdate('date_lim_reglement').'as de,';
|
||||
$sql.= ' s.nom as socnom, s.rowid as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||
@ -211,6 +211,8 @@ class FactureFournisseur extends Facture
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->paye = $obj->paye;
|
||||
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->socnom = $obj->socnom;
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
|
||||
@ -26,4 +26,8 @@ ApproveThisOrder=Approve this order
|
||||
ConfirmApproveThisOrder=Are you sure you want to approve this order ?
|
||||
DenyingThisOrder=Denying this order
|
||||
ConfirmDenyingThisOrder=Are you sure you want to deny this order ?
|
||||
ConfirmCancelThisOrder=Are you sure you want to cancel this order ?
|
||||
ConfirmCancelThisOrder=Are you sure you want to cancel this order ?
|
||||
AddCustomerOrder=Create customer order
|
||||
AddCustomerInvoice=Create customer invoice
|
||||
AddSupplierOrder=Create supplier order
|
||||
AddSupplierInvoice=Create supplier invoice
|
||||
@ -22,6 +22,8 @@ AddDuration=Ajouter la dur
|
||||
Activity=Activité
|
||||
MyActivity=Mon activité
|
||||
DurationEffective=Durée effective
|
||||
ListProposalsAssociatedProject=Listes des propositions commerciales associées au projet
|
||||
ListOrdersAssociatedProject=Listes des commandes associées au projet
|
||||
ListInvoicesAssociatedProject=Listes des factures associées au projet
|
||||
ListProposalsAssociatedProject=Liste des propositions commerciales associées au projet
|
||||
ListOrdersAssociatedProject=Liste des commandes associées au projet
|
||||
ListInvoicesAssociatedProject=Liste des factures associées au projet
|
||||
ListSupplierOrdersAssociatedProject=Liste des commandes fournisseurs associées au projet
|
||||
ListSupplierInvoicesAssociatedProject=Liste des factures fournisseur associées au projet
|
||||
@ -26,4 +26,8 @@ ApproveThisOrder=Approuver la commande
|
||||
ConfirmApproveThisOrder=Etes-vous sûr de vouloir approuver cette commande ?
|
||||
DenyingThisOrder=Refuser la commande
|
||||
ConfirmDenyingThisOrder=Etes-vous sûr de vouloir refuser cette commande ?
|
||||
ConfirmCancelThisOrder=Etes-vous sûr de vouloir annuler cette commande ?
|
||||
ConfirmCancelThisOrder=Etes-vous sûr de vouloir annuler cette commande ?
|
||||
AddCustomerOrder=Créer commande client
|
||||
AddCustomerInvoice=Créer facture/avoir client
|
||||
AddSupplierOrder=Créer commande fournisseur
|
||||
AddSupplierInvoice=Créer facture fournisseur
|
||||
@ -16,14 +16,12 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/product.lib.php
|
||||
\brief Ensemble de fonctions de base pour le module produit et service
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
function product_prepare_head($product, $user)
|
||||
|
||||
@ -15,15 +15,13 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/project.lib.php
|
||||
\brief Ensemble de fonctions de base pour le module projet
|
||||
\ingroup societe
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
function project_prepare_head($objsoc)
|
||||
@ -42,30 +40,11 @@ function project_prepare_head($objsoc)
|
||||
$head[$h][2] = 'tasks';
|
||||
$h++;
|
||||
|
||||
if ($conf->propal->enabled)
|
||||
if ($conf->propal->enabled || $conf->commande->enabled || $conf->facture->enabled)
|
||||
{
|
||||
$langs->load("propal");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Proposals");
|
||||
$head[$h][2] = 'propal';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Orders");
|
||||
$head[$h][2] = 'order';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
$langs->load("bills");
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Invoices");
|
||||
$head[$h][2] = 'invoice';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Referers");
|
||||
$head[$h][2] = 'element';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ class Project extends CommonObject
|
||||
|
||||
/*
|
||||
* \brief Charge objet projet depuis la base
|
||||
* \param rowid id du projet <EFBFBD> charger
|
||||
* \param rowid id du projet a charger
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
@ -163,45 +163,6 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function get_propal_list()
|
||||
{
|
||||
$propales = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propal WHERE fk_projet=$this->id;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$nump = $this->db->num_rows();
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object();
|
||||
|
||||
$propales[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free();
|
||||
/*
|
||||
* Retourne un tableau contenant la liste des propales associees
|
||||
*/
|
||||
return $propales;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . '<br>' .$sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
@ -241,53 +202,25 @@ class Project extends CommonObject
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function get_facture_list()
|
||||
{
|
||||
$factures = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE fk_projet=$this->id;";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$nump = $this->db->num_rows($result);
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$factures[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
/*
|
||||
* Retourne un tableau contenant la liste des factures associees
|
||||
*/
|
||||
return $factures;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie la liste des commande associ<EFBFBD>es au projet
|
||||
*
|
||||
*
|
||||
* \brief Return list of elements for type linked to project
|
||||
* \param type 'propal','order','invoice','order_supplier','invoice_supplier'
|
||||
* \return array List of orders linked to project, <0 if error
|
||||
*/
|
||||
function get_commande_list()
|
||||
function get_element_list($type)
|
||||
{
|
||||
$commandes = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande WHERE fk_projet=$this->id;";
|
||||
$elements = array();
|
||||
|
||||
$sql='';
|
||||
if ($type == 'propal') $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propal WHERE fk_projet=".$this->id;
|
||||
if ($type == 'order') $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande WHERE fk_projet=".$this->id;
|
||||
if ($type == 'invoice') $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE fk_projet=".$this->id;
|
||||
if ($type == 'order_supplier') $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE fk_projet=".$this->id;
|
||||
if ($type == 'invoice_supplier') $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture_fourn WHERE fk_projet=".$this->id;
|
||||
if (! $sql) return -1;
|
||||
|
||||
dolibarr_syslog("Project::get_element_list sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -299,15 +232,14 @@ class Project extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$commandes[$i] = $obj->rowid;
|
||||
$elements[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
/*
|
||||
* Retourne un tableau contenant la liste des commandes associees
|
||||
*/
|
||||
return $commandes;
|
||||
|
||||
/* Return array */
|
||||
return $elements;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -316,11 +248,10 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Supprime le projet dans la base
|
||||
* \param Utilisateur
|
||||
*/
|
||||
|
||||
function delete($user)
|
||||
{
|
||||
|
||||
@ -338,7 +269,7 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Cr<EFBFBD>e une tache dans le projet
|
||||
* \param user Id utilisateur qui cr<EFBFBD>e
|
||||
* \param title titre de la t<EFBFBD>che
|
||||
@ -395,8 +326,8 @@ class Project extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Cr<EFBFBD>e une tache dans le projet
|
||||
/**
|
||||
* \brief Cree une tache dans le projet
|
||||
* \param user Id utilisateur qui cr<EFBFBD>e
|
||||
* \param title titre de la t<EFBFBD>che
|
||||
* \param parent tache parente
|
||||
@ -477,7 +408,7 @@ class Project extends CommonObject
|
||||
{
|
||||
$tasks = array();
|
||||
|
||||
/* Liste des t<EFBFBD>ches dans $tasks */
|
||||
/* Liste des taches dans $tasks */
|
||||
|
||||
$sql = "SELECT t.rowid, t.title, t.fk_task_parent, t.duration_effective";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t";
|
||||
|
||||
@ -1,128 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/projet/commandes.php
|
||||
\ingroup projet commande
|
||||
\brief Page des commandes par projet
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
$langs->load("orders");
|
||||
|
||||
// Sécurité accés client
|
||||
$projetid='';
|
||||
if ($_GET["id"]) { $projetid=$_GET["id"]; }
|
||||
|
||||
if ($projetid == '') accessforbidden();
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projetid);
|
||||
|
||||
|
||||
llxHeader("","../");
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"]);
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
dolibarr_fiche_head($head, 'order', $langs->trans("Project"));
|
||||
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($conf->commande->enabled && $user->rights->commande->creer)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddOrder").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Commandes
|
||||
*
|
||||
*/
|
||||
$commandes = $projet->get_commande_list();
|
||||
$total = 0 ;
|
||||
if (sizeof($commandes)>0 && is_array($commandes))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print_titre($langs->trans("ListProposalsAssociatedProject"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td width="25%">Date</td><td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||
|
||||
for ($i = 0; $i<sizeof($commandes);$i++)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($commandes[$i]);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../commande/fiche.php?id=$commande->id\">$commande->ref</a></td>\n";
|
||||
print '<td>'.dolibarr_print_date($commande->date,'day').'</td>';
|
||||
print '<td align="right">'.price($commande->total_ht).'</td><td> </td></tr>';
|
||||
|
||||
$total = $total + $commande->total_ht;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$i.' '.$langs->trans("Orders").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").': '.price($total).'</td>';
|
||||
print '<td align="left">'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
|
||||
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent
|
||||
print '<div class="tabsAction">';
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
191
htdocs/projet/element.php
Normal file
191
htdocs/projet/element.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/projet/element.php
|
||||
\ingroup projet facture
|
||||
\brief Page des elements par projet
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
$langs->load("suppliers");
|
||||
if ($conf->facture->enabled) $langs->load("bills");
|
||||
if ($conf->commande->enabled) $langs->load("orders");
|
||||
if ($conf->propal->enabled) $langs->load("propal");
|
||||
|
||||
// Sécurité accés client
|
||||
$projetid='';
|
||||
if ($_GET["id"]) { $projetid=$_GET["id"]; }
|
||||
|
||||
if ($projetid == '') accessforbidden();
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projetid);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("","../");
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"]);
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
dolibarr_fiche_head($head, 'element', $langs->trans("Project"));
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1,'compta').'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Factures
|
||||
*/
|
||||
$listofreferent=array(
|
||||
'propal'=>array(
|
||||
'title'=>"ListProposalsAssociatedProject",
|
||||
'class'=>'Propal',
|
||||
'test'=>$conf->propal->enabled),
|
||||
'order'=>array(
|
||||
'title'=>"ListOrdersAssociatedProject",
|
||||
'class'=>'Commande',
|
||||
'test'=>$conf->commande->enabled),
|
||||
'invoice'=>array(
|
||||
'title'=>"ListInvoicesAssociatedProject",
|
||||
'class'=>'Facture',
|
||||
'test'=>$conf->facture->enabled),
|
||||
'order_supplier'=>array(
|
||||
'title'=>"ListSupplierOrdersAssociatedProject",
|
||||
'class'=>'CommandeFournisseur',
|
||||
'test'=>$conf->fournisseur->enabled),
|
||||
'invoice_supplier'=>array(
|
||||
'title'=>"ListSupplierInvoicesAssociatedProject",
|
||||
'class'=>'FactureFournisseur',
|
||||
'test'=>$conf->fournisseur->enabled)
|
||||
);
|
||||
|
||||
foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$title=$value['title'];
|
||||
$class=$value['class'];
|
||||
$qualified=$value['test'];
|
||||
if ($qualified)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print_titre($langs->trans($title));
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td width="25%">'.$langs->trans("Date").'</td><td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||
$elementarray = $projet->get_element_list($key);
|
||||
if (sizeof($elementarray)>0 && is_array($elementarray))
|
||||
{
|
||||
$var=true;
|
||||
$total = 0;
|
||||
for ($i = 0; $i<sizeof($elementarray);$i++)
|
||||
{
|
||||
$element = new $class($db);
|
||||
$element->fetch($elementarray[$i]);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>";
|
||||
print $element->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$date=$element->date;
|
||||
if (empty($date)) $date=$element->datep;
|
||||
print '<td>'.dolibarr_print_date($date,'day').'</td>';
|
||||
print '<td align="right">'.price($element->total_ht).'</td><td> </td></tr>';
|
||||
|
||||
$total = $total + $element->total_ht;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$i.' '.$langs->trans("Bills").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").' : '.price($total).'</td>';
|
||||
print '<td align="left">'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($projet->societe->prospect || $projet->societe->client)
|
||||
{
|
||||
if ($key == 'propal' && $conf->propal->enabled && $user->rights->propale->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddProp").'</a>';
|
||||
}
|
||||
if ($key == 'order' && $conf->commande->enabled && $user->rights->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddCustomerOrder").'</a>';
|
||||
}
|
||||
if ($key == 'invoice' && $conf->facture->enabled && $user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddCustomerInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
if ($projet->societe->fournisseur)
|
||||
{
|
||||
if ($key == 'order_supplier' && $conf->fournisseur->enabled && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
||||
}
|
||||
if ($key == 'invoice_supplier' && $conf->fournisseur->enabled && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent
|
||||
print '<div class="tabsAction">';
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -1,126 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/projet/facture.php
|
||||
\ingroup projet facture
|
||||
\brief Page des factures par projet
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
// Sécurité accés client
|
||||
$projetid='';
|
||||
if ($_GET["id"]) { $projetid=$_GET["id"]; }
|
||||
|
||||
if ($projetid == '') accessforbidden();
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projetid);
|
||||
|
||||
|
||||
|
||||
llxHeader("","../");
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"]);
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
dolibarr_fiche_head($head, 'invoice', $langs->trans("Project"));
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1,'compta').'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($conf->facture->enabled && $user->rights->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddBill").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Factures
|
||||
*/
|
||||
$factures = $projet->get_facture_list();
|
||||
$total = 0;
|
||||
if (sizeof($factures)>0 && is_array($factures))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print_titre($langs->trans("ListInvoicesAssociatedProject"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td width="25%">'.$langs->trans("Date").'</td><td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||
|
||||
for ($i = 0; $i<sizeof($factures);$i++)
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->fetch($factures[$i]);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../compta/facture.php?facid=$facture->id\">$facture->ref</a></td>\n";
|
||||
print '<td>'.dolibarr_print_date($facture->date,'day').'</td>';
|
||||
print '<td align="right">'.price($facture->total_ht).'</td><td> </td></tr>';
|
||||
|
||||
$total = $total + $facture->total_ht;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$i.' '.$langs->trans("Bills").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").' : '.price($total).'</td>';
|
||||
print '<td align="left">'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
|
||||
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent
|
||||
print '<div class="tabsAction">';
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/projet/propal.php
|
||||
\ingroup projet propale
|
||||
\brief Page des propositions commerciales par projet
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
$langs->load("propal");
|
||||
|
||||
// Sécurité accés client
|
||||
$projetid='';
|
||||
if ($_GET["id"]) { $projetid=$_GET["id"]; }
|
||||
|
||||
if ($projetid == '') accessforbidden();
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projetid);
|
||||
|
||||
|
||||
|
||||
llxHeader("","../");
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"]);
|
||||
$projet->societe->fetch($projet->societe->id);
|
||||
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
dolibarr_fiche_head($head, 'propal', $langs->trans("Project"));
|
||||
|
||||
|
||||
$propales = array();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->getNomUrl(1).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($conf->propal->enabled && $user->rights->propale->creer)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/addpropal.php?socid='.$projet->societe->id.'&action=create&projetid='.$projet->id.'">'.$langs->trans("AddProp").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
$propales = $projet->get_propal_list();
|
||||
|
||||
if (sizeof($propales)>0 && is_array($propales))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print_titre($langs->trans("ListProposalsAssociatedProject"));
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td width="25%">'.$langs->trans("Date").'</td><td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||
|
||||
for ($i = 0; $i<sizeof($propales);$i++)
|
||||
{
|
||||
$propale = new Propal($db);
|
||||
$propale->fetch($propales[$i]);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"../comm/propal.php?propalid=$propale->id\">$propale->ref</a></td>\n";
|
||||
|
||||
print '<td>'.dolibarr_print_date($propale->datep).'</td>';
|
||||
|
||||
print '<td align="right">'.price($propale->total_ht).'</td><td> </td></tr>';
|
||||
$total = $total + $propale->total_ht;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$i.' '.$langs->trans("Proposal").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").': '.price($total).'</td>';
|
||||
print '<td align="left">'.$langs->trans("Currency".$conf->monnaie).'</td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user